package com.alien.admin.modules.container.service.dto;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

@Data
public class K8sProjectChartDto implements Serializable {
    private Map<String, Object> meta;
    private Object content;

    public K8sProjectChartDto(Object content) {
        this.content = content;
    }

    public K8sProjectChartDto(Object content, Map<String, Object> meta) {
        this.content = content;
        this.meta = meta;
    }

    public static K8sProjectChartDto build(Object content) {
        return new K8sProjectChartDto(content);
    }

    public static K8sProjectChartDto build(Object content, String unit) {
        Map<String, Object> meta = new HashMap<>(10);
        meta.put("xItem", "dt");
        meta.put("yItem", "value");
        meta.put("unit", unit);

        return new K8sProjectChartDto(content, meta);
    }

    @Data
    public static class ChartElm {
        String dt;
        Long value;
    }
}
